<template>
	<span>
		<a-button icon="download" type="link" @click="openModal">导出</a-button>
		<export-data-modal ref="exportDataModal" :fileName="fileName" :fieldInfoUrl="fieldInfoUrl" :exportUrl="exportUrl" :visible="visible" @ok="confirm" @cancel="cancel"></export-data-modal>
	</span>
</template>

<script>
	import ExportDataModal from "./modal/ExportDataModal.vue"
	export default {
		components: {
			ExportDataModal
		},
		props: {
			fileName: {
				type: String
			},
			fieldInfoUrl: {
				type: String
			},
			exportUrl: {
				type: String
			}
		},
		data() {
			return{
				visible: false
			}
		},
		methods: {
			confirm(){
				this.visible = false;
				this.$emit("ok");
			},
			cancel(){
				this.visible = false;
				this.$emit("cancel");
			},
			openModal(){
				this.$refs.exportDataModal.getFieldInfo();
				this.visible = true;
			}
		}
	}
</script>

<style>
	
</style>